const events = require('events');

var eventEmitter = new events.EventEmitter();

var connectHandler = function() {
	console.log("连接");
	console.log(arguments)
	for(var i in arguments)
		console.log(i, arguments[i])
	console.log("连接成功");
	eventEmitter.emit("data_recieved");
}

eventEmitter.on("connection", connectHandler);
eventEmitter.on("data_recieved", ()=>{
	console.log("数据接受")
	console.log(arguments)
	for(var i in arguments)
		console.log(arguments[i])
	console.log("数据接受成功");
});

setTimeout(()=>{
	eventEmitter.emit("connection", 1,22);
}, 1000);

console.log("程序执行完毕");
